package yichang;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		double a, b, c;
		Scanner in = new Scanner(System.in);
		System.out.print("请输入两个数:");
		try {
			a = in.nextDouble();
			b = in.nextDouble();
			c = a / b;
			if (String.valueOf(c).equals("Infinity")) {
				in.close();
				throw new ArithmeticException();
			}
			System.out.println("商为:" + c);
		} catch (InputMismatchException e) {
			System.err.println("只能输入整数");
		} catch (ArithmeticException e) {
			System.err.println("除数不能为0");
		}
		System.out.println("程序结束");
		in.close();
	}
}
